#!/usr/bin/env python
###############################################################################################
#  Author:
_author = '<a href="mailto:debuti@gmail.com">Borja Garcia</a>'
# Program:
_name = 'vim.py'
# Descrip:
_description = '''This is the automatic installation of vim, providing methods
 to install, update, configure and uninstall the whole software.'''
# Version:
_version = '0.0.0'
#    Date:
_date = 'YYYY-MM-DD:hh:mm'
# License: This script doesn't require any license since it's not intended to be redistributed.
#          In such case, unless stated otherwise, the purpose of the author is to follow GPLv3.
# History: 0.0.0 (YYYY-MM-DD:hh:mm)
#            -Initial release
###############################################################################################

import sys
import optparse

# Global variables


# Error declaration

error = { "" : "",
          "" : "",
          "" : "" }

# Public functions

def install():
    '''This procedure installs the software
    '''
    runBash("sudo apt-get update")
    runBash("sudo apt-get install vim")
    pass

def configure():
    '''This procedure configures the software
    '''
    pass

def uninstall():
    '''This procedure uninstalls the software
    '''
    pass

def update():
    '''This procedure updates the software
    '''
    pass

# Entry point if called talcual to be selfstanding

if __name__ == '__main__':

    p = optparse.OptionParser(description=_description,
                              prog=_name,
                              version=_version,
                              usage='''%prog [options]''')
    p.add_option('--install','-i', action="store_true", dest="install", help='Installs the software')
    p.add_option('--configure','-c', action="store_true", dest="configure", help='Configures the software')
    p.add_option('--remove','-r', action="store_true", dest="uninstall", help='Uninstalls the software')
    p.add_option('--update','-u', action="store_true", dest="update", help='Updates the software')

    #Parse the commandline
    options, arguments = p.parse_args()

    #Decide what to do
    if len(arguments) != 0 :
        p.print_help()
        sys.exit(-1)
    else:
        if options.install:
            install()
        if options.configure:
            configure()
        if options.uninstall:
            uninstall()
        if options.update:
            update()
